{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# CS206: Data Structures\n", "\n", "## Spring 2016\n", "\n", "### Professor Blank\n", "\n", "### Assignment #1\n", "\n", "Should be timestamped before start of class on Tuesday, January 26, 2016.\n", "\n", "* **Topic**: Notebooks, editing, code, and reflections.\n", "* **Description**: For this assignment, you will create your first notebook, create a title, by-line, execute code, and provide a reflection.\n", "\n", "Grading rubric:\n", "\n", "* 10 pts Title\n", "* 10 pts By-line and description (what is this?)\n", "* 40 pts Code\n", "* 40 pts Reflection\n", "\n", "**NOTE**: there is a spelling checker (the check-mark button next to \"CellToolbar\"). Turn it on.\n", "\n", "Assignment Process:\n", "\n", "* Copy the file /tmp/nbgrader_config.py to your home directory (one-time thing)\n", "* Go to the Assignments tab on the dashboard\n", "* Fetch the assignment\n", "* Open \"My First Notebook.ipynb\"\n", "* Edit it to include the four sections of the rubric\n", "* Submit it (at least once)\n", "\n", "Your notebook might look like:\n", "\n", "\n", "\n", "but that is lame. This is the structure of notebooks that you will submit all semester long.\n", "\n", "What makes a good Reflection?\n", "\n", "* write about this project/aspect/topic of the course\n", "* note what you learned\n", "* what did you find challenging? easy? tricky? rewarding?\n", "* connect this material to your personal interests\n", "\n", "What makes for good code?\n", "\n", "* try out some things\n", "* use: variables, booleans, ints, functions, if/else, loop\n", "* be creative! have fun!\n", "\n", "#### NO CREDIT FOR LATE SUBMISSIONS" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here are two lines in a notebook or terminal that will activate the grading extension:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "| Added variable size of type int with initial value 500\n", "\n" ] } ], "source": [ "int size = 500;" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Hello\n" ] } ], "source": [ "printf(\"Hello\");" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Hello!\n", "\n" ] } ], "source": [ "System.out.println(\"Hello!\");" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "| Added variable year of type int with initial value 2016\n", "\n" ] } ], "source": [ "int year = 2016;" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "| Expression value is: true\n", "| assigned to temporary variable $5 of type boolean\n", "\n" ] }, { "data": { "text/plain": [ "true" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(year % 4) == 0" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "| Added method is_leap_year(int)\n", "\n" ] } ], "source": [ "boolean is_leap_year(int year) { \n", " if (year % 400 == 0 ) {\n", " return true;\n", " } else if ((year % 100) == 0) {\n", " return false;\n", " } else if ((year % 4) == 0) {\n", " return true;\n", " } else {\n", " return false;\n", " }\n", "}" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "| Expression value is: false\n", "| assigned to temporary variable $7 of type boolean\n", "\n" ] }, { "data": { "text/plain": [ "false" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "is_leap_year(2100)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1943 is true\n" ] } ], "source": [ "printf(\"%s is %s\", 1943, true);" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "| Added method hello(String)\n", "\n" ] } ], "source": [ "void hello(String name) {\n", " printf(\"Hello, %s! How are you?\", name);\n", " System.out.println(\"Hello, \" + name + \". How are you?\");\n", "}" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Hello, Sally! How are you?Hello, Sally. How are you?\n", "\n" ] } ], "source": [ "hello(\"Sally\");" ] } ], "metadata": { "kernelspec": { "display_name": "Java 9", "language": "java", "name": "java9" }, "language_info": { "file_extension": ".class", "mimetype": "application/java-vm", "name": "java" } }, "nbformat": 4, "nbformat_minor": 0 }